<template>
    <el-dropdown @command="handleChangeConsole">
        <i class='iconfont iconicon_exchange' >
        </i>
        <template #dropdown>
            <el-dropdown-menu>
                <el-dropdown-item command="-2" >运营控制台</el-dropdown-item>
                <el-dropdown-item command="-1" >企业控制台</el-dropdown-item>
                <el-dropdown-item command="0" >业务控制台</el-dropdown-item>
            </el-dropdown-menu>
        </template>
    </el-dropdown>
</template>

<script>
import { mapGetters } from "vuex";
import website from "@/config/website";
import store from "@/store";
export default {
  name: "top-console",
  data () {
      return {
          userRoles: [],
      };
  },
  created () { },
  mounted () { },
  computed: {
    ...mapGetters(['userInfo','logsList', "logsFlag", "logsLen"])
  },
  props: [],
  methods: {
      handleChangeConsole(consoleType){
          sessionStorage.setItem("SET_CURRENT_CONSOLE",consoleType);
          website.currentConsole = consoleType;
          this.$store.dispatch("GetMenu").then(data => {
              if (data.length !== 0) {
                  this.$router.$avueRouter.formatRoutes(data, true);
              }
          });
          this.$router.push('/desk/index');
      },onLoad(){
          console.log("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
          console.log("user roles:"+store.getters.userInfo.roles);
          this.userRoles = store.getters.userInfo.roles;

      }
  }

};
</script>

<style lang="scss" scoped>

</style>
